import pymysql

from init_task import settings
from common.libs.encrypt import decryption


pymysql.install_as_MySQLdb()

for db, value in settings.DATABASES.items():
    password = value.get('PASSWORD')
    if password:
        s, v = decryption(settings.AES_SECRET, password)
        if s is True:
            settings.DATABASES[db] ['PASSWORD'] = v
